#!/bin/bash
rm pmtana
make pmtana

echo -n "enter your Daq_run_number:" 
read daqid
thetime=$( ls /pmtfs/disk02/container_data/container4/test/FADC_Run/$daqid |grep -m1 $daqid|cut -d "_" -f 3)
#echo $thetime
map=(403 401 402 410 409 418 417 425 426 412 411 0 419 428 427 404 414 405 420 413 422 430 421 429 407 406 408 416 415 424 423 432 431)

for i in {0..10}
do
	for j in {0..2}
	do
		num=$((i*3+j))
		drawer=${map[$num]}
		echo $drawer
		pmtsn=$( cat /pmtfs/disk02/container_data/container4/test/FADC_Run/$daqid/PMT_Input_${daqid}.txt |grep $'\t'$drawer$'\t' |cut -d $'\t' -f 1)
#		echo $pmtsn
		./pmtana -d $thetime -a $daqid -g $i -gs $j -sn $pmtsn
	done
done
#for
